The Java program runtime environment (e.g., Java virtual machine “VM” or “JVM”) provides a built-in mechanism for allocating and deallocating memory in a computing system. In Java, memory is allocated to objects. The JVM automatically handles the amount and allocation of memory upon an object's creation. The Java runtime environment employs a “garbage collector” (“GC”) to reclaim the memory allocated to an object that is no longer needed, as for example, when an object is deleted. Once the GC determines that the object is no longer accessible (e.g., when there is no longer any references to it stored in any variables, the fields of objects, or the elements of any arrays, etc.), it reclaims the allocated memory. When objects in a Java application are no longer referenced, the heap space the object occupied is to be recycled so that the space becomes available for subsequently-created objects.
While Java provides for automatic GC at the application layer, what is needed is a similar mechanism at the database or persistence layer.